//
//  MoBanElevenTableviewCell.m
//  MoBan
//
//  Created by apple on 16/7/27.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "MoBanElevenTableviewCell.h"
#import "MoBanElevenModel.h"
@interface MoBanElevenTableviewCell()
@property(nonatomic,strong)UIButton *butten1;
@property(nonatomic,strong)UIButton *butten2;
@property(nonatomic,strong)MoBanElevenModel *model;
@end
@implementation MoBanElevenTableviewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self= [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self addUI];
    }
    return self;

}
-(void)addUI
{

    self.butten1 = [[UIButton alloc]init];
    [self.butten1 setImage:[UIImage imageNamed:@"check.png"] forState:UIControlStateSelected];
    [self.butten1 setImage:[UIImage imageNamed:@"checknor.png"] forState:UIControlStateNormal];
    [self.butten1 addTarget:self action:@selector(buttne1Clic:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.butten1];
    
    self.butten2=[[UIButton alloc]init];
    [self.butten2 setImage:[UIImage imageNamed:@"check.png"] forState:UIControlStateSelected];
    [self.butten2 setImage:[UIImage imageNamed:@"checknor.png"] forState:UIControlStateNormal];
    [self.butten2 addTarget:self action:@selector(butten2Clic:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.butten2];
    
    
}
-(void)layoutSubviews
{
    
    [super layoutSubviews];
    self.butten1.frame = CGRectMake(10*Kscr, 10*Kscr, 20*Kscr, 20*Kscr);
    self.butten2.frame = CGRectMake(10*Kscr, self.butten1.bottom+10*Kscr, 20*Kscr, 20*Kscr);
}
-(void)buttne1Clic:(UIButton *)butten
{
    butten.selected =!butten.selected;
    self.butten2.selected = butten.selected;
    self.model.selected = butten.selected;

}
-(void)butten2Clic:(UIButton *)butten
{
    butten.selected =!butten.selected;
    self.butten1.selected = butten.selected;
    self.model.selected = butten.selected;


}
-(void)ZBdatasouce:(MoBanElevenModel *)model
{
    self.model = model;
    self.butten1.selected = model.selected;
    self.butten2.selected =model.selected;

}
-(void)ZBCellBtnSelected:(UIButton *)butten
{
    self.butten1.selected = butten.selected;
    self.butten2.selected = butten.selected;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
